package com.mallcloud.mall.common.core.constant.enums.mall;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

/**
 * 广告
 */
@Getter
@AllArgsConstructor
public enum PointsProductEnum {

	//字典
	REDEEM_STATUS("REDEEM_STATUS", "积分商品库存记录字典"),
	;

	private final String type;
	private final String description;

	@Getter
	@AllArgsConstructor
	public enum RedeemTypeEnum {
		TYPE_1(0, "积分兑换"),
		TYPE_2(1, "积分+钱兑换"),
		;
		private Integer code;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(type)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum RebateTypeEnum {
		TYPE_0(0, "全部"),
		TYPE_1(1, "会员返利"),
		TYPE_2(2, "促销"),
		;
		private Integer code;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(type)).findFirst().get().getDescription();
		}
	}

	@Getter
	@RequiredArgsConstructor
	public enum ProductStatusEnum {
		Y("已生效"),
		N("已失效"),
		D("已删除"),
		;
		private final String description;

		public static String getDecs(String status) {
			return Arrays.stream(values()).filter(x -> x.name().equals(status)).findFirst().get().getDescription();
		}
	}
}
